{extend name="index/index" /}

{block name="navigation"}
<nav class="main-nav">
    <div class="menu-top-menu-container">
        <ul id="menu-top-menu" class="clearfix">
            <li><a href="{:url('index/index/index')}">首页</a></li>
            <li><a href="{:url('index/Recall/index')}">韶华追忆</a></li>
            <li><a href="{:url('index/Mood/index')}">心情随笔</a></li>
            <li><a href="{:url('index/Share/index')}">技术分享</a></li>
            <li class="current-menu-item"><a href="{:url('index/Post/index')}">技术讨论</a></li>
            <!--<li><a href="{:url('index/Archive/index')}">个人归档</a></li>-->
            <li><a href="{:url('/index/Me/index')}">关于我</a></li>
        </ul>
    </div>
</nav>
{/block}

{block name="indexmain"}
{js href="/static/index/js/jquery.min.js"}
{css href="/static/index/assets/libs/bootstrap/css/bootstrap.min.css"}
{js href="/static/index/assets/libs/bootstrap/js/bootstrap.min.js"}
{css href="/static/index/css/toastr.min.css" }
{js href="/static/index/js/toastr.min.js"}
<style type="text/css">
    
    .pro a:hover
    {
        text-decoration: none;
        color:#E74851;
        /*background-color: blue;*/
    }
</style>
                <!-- Start of Page Container -->
                <div class="page-container">
                        <div class="container">
                                <div class="row">
                                        <!-- start of page content -->
                                         <!-- <div class="col-md-1">
                                        </div> -->
                                        <div class="span8 page-content" style="margin-top: 30px">
                                            
                                            <ul class="breadcrumb">
                                                        <li>你所在的位置是:<span class="divider">/</span></li>
                                                        <li><a href="{:url('index/index/index')}">首页 </a> <span class="divider">/</span></li>
                                                        <li class="active">技术讨论</li>
                                                </ul>

                                            <article class="format-standard type-post hentry clearfix">

                                                        <header class="clearfix">

                                                                <h3>
                                                                        <a >{$data.postname}</a>
                                                                </h3>

                                                                <div class="post-meta clearfix">
                                                                        <span class="glyphicon glyphicon-user"style='color:#AAAAAA;'>&nbsp;{$pu}</span>
                                                                        <span class="date">{$data.posttime}</span>
                                                                        <input value="{$data.post_id}" type="hidden" id="postid">
                                                                        
                                                                        
                                                                </div>

                                                        </header>
                                                        {$data.postcontent}
                                                        <img id="img" src="/static/postpic/{$data.artpic}">
                                                                
                                                </article>
                                                <blockquote style="margin-top:50px ;height:90px; padding-top:20px">
                                                    <p style="margin-left: 50px"><b>版权声明</b>：本贴于&nbsp;<span style="color: gray;">{$data.posttime}</span>&nbsp;由&nbsp;<span style="color: gray;">{$userdata.username}</span>&nbsp;发布</p>
                                                    <p style="margin-left: 50px"><b>转载请注明</b>：feture 博客</p>
                                                </blockquote>

                                                <div>
                                                   <span class="tags">
                                                            <strong>标签:&nbsp;&nbsp;</strong>
                                                            <spans style='color:#F0B70C'>普通帖子</span>
                                                    </span>
                                                </div>

                                                <div id="respond" style="margin-top: 10px;">

                                                <form action="#" method="post" id="commentform">

                                                <div>

                                                <!-- 判断是否已经登录 -->
                                                        {switch name="session"}
                                                        {case value=""}

                                                            <a href="{:url('index/Login/login',['id'=>$data['post_id'],'type'=>'post'])}"  style="display: block;height: 45px; width:45px;border:1px solid #E74851; text-align: center; line-height:45px; 
                                                            color:#E74851;
                                                             " class="img-circle">登录</a>

                                                        {/case}
                                                        {default /}

                                                            <a href="javascript:void(0)"; style="position: relative;left:10px;">
                                                                <a href="#right-panel" id="right-panel-link"><img node-type="user-head" src="/static/userhead/{$userpic == null ? 'default-header.jpg' : $userpic}" width="45" height="45" alt="" class="img-circle"></a>
                                                            <span

                                                             style='position: relative;top:20px;left:5px; background-color: white;  color:#E74851;font-size: 18px;'

                                                             >用户名： {$session.username}</span>

                                                            <div node-type="head-img-ie-mask" class="head-img-ie-mask"></div>
                                                        </a>

                                                        {/switch}
                                                <!-- 判断结束 -->

                                                        <textarea class="span8" name="comment" id="comment" cols="58" rows="5" placeholder="既然来了，就说几句吧" style="outline:none;color: #E74851;border:1px solid #E74851" ></textarea>
                                                </div>
                                                <div class="clearfix">
                                                        <input class="btn btn-danger" name="" type="button" id="addcom"  value="畅言一下吧" class="btn" style="margin-top:10px; float: right;">
                                                </div>

                                                </form>

                                                </div>

                                                <div >
                                                <a id="comments-title" style="text-align: center; border: 1px solid #E74851; border-bottom: none; width: 70px;  height: 40px; line-height: 40px;font-size: 20px; color:#E74851; border-radius: 10px; display: inline-block;" >评论</a>
                                                <input type='hidden' id="ses" value = '{$session.username}'>
                                                <a style="display: inline-block;float: right; width: 100px;  height: 40px; line-height: 40px;font-size: 15px;color:#E74851; "><font style="font-size: 20px;">{$count}</font>&nbsp;&nbsp;条评论</a>
                                                </div>
                                                <hr style="border:1px solid #E74851;margin: 0px;" class="clearfix"/>
        <div style="margin-top: 10px;">
        <div style="height: 40px; line-height: 40px;">
            <a style=" display: inline-block; height: 20px; width:5px;background-color: #E74851;border-radius: 2px;"></a>
            <a style="display: inline-block;color:#E74851; font-size: 16px;margin-left: 3px;position: relative;top:-4px;">最新评论</a>
        </div>
                {volist name='postcom' id='val'}
                <div>
                    <div class="col-md-12 col-xs-12 col-sm-12">

                        <div class="col-md-1 col-xs-2 col-sm-1">
                            <img src="/static/userhead/{$val.userpic == null ? 'default-header.jpg' : $val.userpic}" class="img-circle" style="width:100%;height: 100%;">
                        </div>
                        <div style="float:left;" class="col-md-2 col-xs-1 col-sm-2">{$val.username}</div>
                        <div class="col-md-7 col-xs-6 col-sm-8" style="text-align: right;"><font style="color:gray;">{$val.commenttime}</font></div>
                        <div class="col-md-10 col-xs-11 col-sm-10">

                            <div class="col-md-12 col-xs-12 col-sm-12">{$val.comcontent}</div>
                            <div class="col-md-12 col-xs-12 col-sm-12" >
                            
                                    <!-- 追平内容 -->

                                {if ($val.prcom == null)}
                                {else /}
                                <div class="col-md-12 col-xs-12 col-sm-12" style="border:1px solid #DEE4E9;padding: 10px;margin-top: 15px;">
                                    {volist name='$val.prcom' id='v' }
                                    <div class="col-md-12 col-xs-12 col-sm-12">
                                    <p style="color:#E74851;font-size:13px;">{$v.prcuser}</p>
                                    <p>{$v.prcontent}</p>
                                    </div>
                                    {/volist}
                                </div>
                                {/if}

                                    <!-- 追平内容 -->

                            </div>
                        </div>
                    </div>

                    <div class="col-md-12 pro" style="margin-bottom: 20px; margin-top:30px; border-bottom: 1px dashed gray;padding-bottom: 10px;">
                        <span class="col-md-9"></span>
                        <a style="font-size: 13px; padding-right: 15px;" class='refuse'>回复</a>
                        <span style=" color:gray;padding-right: 0px;" class="glyphicon glyphicon-thumbs-up like-count" datalove = '{$val.postcom_id}'>

                        </span>
                        <span class="lovenum" style="padding-right: 10px;">{$val.comlove}</span>
                        <span  style="color:gray; padding-right: 0px;" class="glyphicon glyphicon-thumbs-down hit-count" datahit = '{$val.postcom_id}'></span>
                        <span class="hitnum" style="padding-right: 10px;">{$val.comhit}</span>


                       <!--  <div style="width:200px;height:100px;position: relative;top:20px;"></div>
 -->
                        <div class="refusetet" style="height: 180px;display: none;">
                            <textarea class="span6 prcomment" name="prcomment" cols="50" rows="5" placeholder="追评吧......" style="height:70%;width:95%;outline:none;color: #E74851;border:1px solid #E74851;" ></textarea>
                            <div class="clearfix">
                                <input type="hidden" class="comid"  value="{$val.postcom_id}" >
                                <input class="btn btn-danger addprcom" name="" type="button"  value="追评一下" class="btn" style="margin-right: 30px; margin-top:20px; float: right;">
                            </div>
                        </div>
                    </div>
                       
                </div>
                {/volist}

                
                   
        </div>

</div>

                                        <!-- start of sidebar -->
                                        <aside class="span4 page-content">

                                                <section class="widget" style="margin-top: 30px;">
                                                    <div class="support-widget">
                                                        <h3 class="title">我是博主啦</h3>
                                                        <p class="intro">关于我的一些心情和分享的一些小的知识呢，大家也可以积极的讨论...</p>
                                                    </div>
                                                </section>


                                                <section class="widget">
                                                        <h3 class="title">热门好帖</h3>
                                                        <ul class="articles">
                                                                {volist name='posthot'  id='val' }
                                                                <li class="article-entry standard">
                                                                        <h4><a href="single.html">{$val.postname}</a></h4>
                                                                        <span class="article-meta">{$val.posttime}</span>
                                                                        <span class="like-count diann"  datalove = '{$val.post_id}'>{$val.postlove}</span>
                                                                </li>
                                                                {/volist}
                                                                
                                                        </ul>
                                                </section>

                                                <section class="widget">
                                                        <h3 class="title">友情连接</h3>
                                                        <ul id="recentcomments">
                                                            {volist name='links' id='val'}
                                                                <li class="recentcomments"><a href='{$val.linksurl}'>{$val.linksname}</a></li>
                                                            {/volist}
                                                        </ul>
                                                </section>

                                        </aside>
                                        <!-- end of sidebar -->
                                </div>
                        </div>

                       
                </div>


<script type="text/javascript">
    
    $(function(){

        toastr.options = {
        closeButton: true,// 是否显示关闭按钮
        progressBar: true,// 实现显示计时条
        timeOut: "2000",// 自动关闭时间
        positionClass: "toast-top-right"// 提示位置
        // positionClass: "toast-top-full-width"// 提示位置
        // toast-top-full-width 顶端，宽度铺满整个屏幕
        // toast-top-right  顶端右边
        };

        $('#addcom').click(function (){

            if($('#ses').val().length == 0){
                toastr.error('你尚未登录');
            }else{

                var info = 'com'+'='+$('#comment').val()
                    +'&'+'postid'+'='+$('#postid').val();
                // alert(info);

                $.ajax({
                    type: 'post',
                    url: '/index/post/addcoment',
                    data: info,
                    dataType : 'json',
                    success : function (data){
                         if (data.status) {
                            toastr.success('评论成功,增加3点积分');
                            setTimeout(function (){
                                window.location.reload();
                            },2000);
                        } else {
                            toastr.error('评论失败');
                        }
                    },
                    error : function () {
                         alert('执行失败');
                        
                    }
                });

            }

        });

    });


</script>

<!-- 追评的ajax -->

<script type="text/javascript">
    
    $(function(){

        toastr.options = {
        closeButton: true,// 是否显示关闭按钮
        progressBar: true,// 实现显示计时条
        timeOut: "2000",// 自动关闭时间
        positionClass: "toast-top-right"// 提示位置
        // positionClass: "toast-top-full-width"// 提示位置
        // toast-top-full-width 顶端，宽度铺满整个屏幕
        // toast-top-right  顶端右边
        };

        $('.addprcom').click(function (){

            if($('#ses').val().length == 0){
                toastr.error('你尚未登录');
            }else{

                var info = 'prcom'+'='+$(this).parent().siblings('textarea').val()
                    +'&'+'postid'+'='+$('#postid').val()
                    +'&'+'comid'+'='+$(this).siblings('.comid').val();
                // alert(info);
                $.ajax({
                    type: 'post',
                    url: '/index/post/addprcoment',
                    data: info,
                    dataType : 'json',
                    success : function (data){
                         if (data.status) {
                            toastr.success('追评成功,增加3点积分');
                            setTimeout(function (){
                                window.location.reload();
                            },2000);
                        } else {
                            toastr.error('追评失败');
                        }
                    },
                    error : function () {
                         alert('执行失败');
                        
                    }
                });

            }

        });

    });


</script>

<!-- 追评的ajax -->


<!-- 判断是否有图片 -->
<script type="text/javascript">
    
        var img = $('#img').attr('src');
        // alert(img);
        var imgstr = img.substr('16');
        if(imgstr.length==0){
                $('#img').attr('style','display: none;');
        }
        // /static/postpic/ef7726ba08a0f64821ecd00e781680d11514969225.jpg

</script>
<!-- 判断是否有图片 -->

<!-- 追评 -->
<script type="text/javascript">
    
      $('.refuse').click(function(){

            // $(this).siblings("div").animate({
            //    height:'toggle'
            // });
            $(this).siblings("div").toggle("slow");
            

        });

</script>

<script type="text/javascript">
    

            // $('.refuse').siblings("div").toggle(1);
            

</script>
<!-- 追评 -->
    
<!-- 点赞的ajax -->

<script type="text/javascript">
    
    $('.like-count').click(function (){
        var info = 'postid' + '=' + $(this).attr('datalove');
        var thisbtn = $(this);
        // alert(info);
        $.ajax({
            type: 'post',
            url: '/index/post/postlove',
            data: info,
            dataType : 'json',
            success : function (data){
                 if(data.status){
                    // toastr.success('点赞成功');
                    thisbtn.html(data.love);
                    thisbtn.attr('style','color:blue;');

                    // window.location.reload();

                 }else{
                    toastr.error('点赞失败');
                 }
            },
            error : function () {
                 alert('执行失败');
                
            }
        });

    });

</script>


<!-- 点赞的ajax -->



<!-- 评论点赞的ajax -->

<script type="text/javascript">
    
    $('.diann').click(function (){
        var info = 'comid' + '=' + $(this).attr('datalove');
        var thisbtn = $(this);
        // alert(info);
        $.ajax({
            type: 'post',
            url: '/index/post/comlove',
            data: info,
            dataType : 'json',
            success : function (data){

                 if(data.status){
                    // toastr.success('点赞成功');
                    thisbtn.siblings(".lovenum").html(data.love);
                    thisbtn.attr('style','color:red;');

                    // window.location.reload();

                 }else{
                    toastr.error('点赞失败');
                 }
            },
            error : function () {
                 alert('执行失败');
                
            }
        });

    });

</script>


<!--评论点赞的ajax -->

<!-- 评论讨厌的ajax -->

<script type="text/javascript">
    
    $('.hit-count').click(function (){
        var info = 'comid' + '=' + $(this).attr('datahit');
        var thisbtn = $(this);
        // alert(info);
        $.ajax({
            type: 'post',
            url: '/index/post/comhit',
            data: info,
            dataType : 'json',
            success : function (data){

                 if(data.status){
                    // toastr.success('点赞成功');
                    thisbtn.siblings(".hitnum").html(data.hit);
                    thisbtn.attr('style','color:red;');

                    // window.location.reload();

                 }else{
                    toastr.error('点赞失败');
                 }
            },
            error : function () {
                 alert('执行失败');
                
            }
        });

    });

</script>


<!--评论讨厌的ajax -->


{/block}


